<template>
    <el-form ref="ruleForm" :model="ruleForm" label-width="200px">
      <el-form-item    label="单次最大抵扣积分">
        <el-input-number v-model="ruleForm.maxDeductPoints" :controls-position="right" :min="0"></el-input-number>
      </el-form-item>
      <el-form-item label="满多少可以抵扣">
        <el-input-number v-model="ruleForm.minAmountForDeduction" :controls-position="right" :min="0"></el-input-number>
      </el-form-item>
      <el-form-item label="积分抵用比例">
        <el-input-number v-model="ruleForm.pointsRatio" :controls-position="right" :min="0"></el-input-number>
        <el-tooltip class="item" effect="dark" content="1积分抵多少金额" placement="top">
          <i class="el-icon-info"></i>
        </el-tooltip>
      </el-form-item>
      <el-form-item label="消费必须满一定额度才可使用">
        <el-input-number v-model="ruleForm.minSpendToUse" :controls-position="right" :min="0"></el-input-number>
      </el-form-item>
      <el-form-item label="限制一次只能使用多少积分">
        <el-input-number v-model="ruleForm.maxPointsPerUse" :controls-position="right" :min="0"></el-input-number>
      </el-form-item>
      <el-form-item>
        <el-button type="primary" @click="submitForm('ruleForm')">提交</el-button>
        <el-button @click="resetForm('ruleForm')">重置</el-button>
      </el-form-item>
    </el-form>
  </template>
  <script>
export default {
  data() {
    return {
      ruleForm: {
        maxDeductPoints: 0, // 单次最大抵扣积分
        minAmountForDeduction: 0, // 满多少可以抵扣
        pointsRatio: 0, // 积分抵用比例
        minSpendToUse: 0, // 消费必须满一定额度才可使用
        maxPointsPerUse: 0, // 限制一次只能使用多少积分
      }
    };
  },
  methods: {
    submitForm(formName) {
      this.$refs[formName].validate((valid) => {
        if (valid) {
          alert('提交成功!');
        } else {
          //  console.log('error submit!!');
          return false;
        }
      });
    },
    resetForm(formName) {
      this.$refs[formName].resetFields();
    }
  }
};
</script>
<style scoped>


</style>